﻿<div class="main">
    <form id="_form" class=" form-group-sm form ui-validForm" method="post" data-source="@Model" data-validate-params="beforeSubmit:'BeforeSubmit'">
        <div class="form-group">
            <label class="control-label" for="name">名称</label>
            <div class="controls">
                <input type="text" name="Name" id="Name" maxlength="50" class="form-control" data-validate="dataType:'*',nullMsg:'请填写备注！'">
                <span class="help-block">菜单项目名称，仅用于识别</span>
            </div>
        </div>

        <div class="form-group">
            <label class="control-label" for="controller">命名空间</label>
            <div class="controls">
                <input type="text" name="Namespace" id="Namespace" maxlength="100" class="form-control trimSpace" data-validate="dataType:'*',nullMsg:'请填写命名空间!',errorMsg:'请填写正确的命名空间!'">
                <span class="help-block">控制器所在的命名空间</span>
            </div>
        </div>

        <div class="form-group">
            <label class="control-label" for="name">控制器</label>
            <div class="controls">
                <input type="text" name="Controller" id="Controller" maxlength="50" data-validate="dataType:'string',nullMsg:'请填写控制器名称！'" class="form-control trimSpace">
                <span class="help-block">控制器名称,其中Controller后缀不需要填写</span>
            </div>
        </div>

        <div class="form-group">
            <label class="control-label" for="name">方法</label>
            <div class="controls">
                <input type="text" name="Action" id="Action" maxlength="50" data-validate="dataType:'string',nullMsg:'请填写方法名称！'" class="form-control trimSpace">
                <span class="help-block">方法名称</span>
            </div>
        </div>

        <div class="form-group">
            <label class="control-label" for="name">请求类型</label>
            <div class="controls">
                <select id="Method" name="Method" class="form-control form-control-xs">
                    <option>GET</option>
                    <option>POST</option>
                </select>
                <span class="help-block"></span>
            </div>
        </div>

        <div class="submit-footerbar">
            <label class="control-label"></label>
            <div class="controls">
                <input type="hidden" name="Id" id="Id" />
                <input type="hidden" name="IsDefault" id="IsDefault" />
                <input type="hidden" name="MenuId" id="MenuId" value="@Request.QueryString["menuId"]" />
                <button type="button" class="btn btn-primary ui-pagePost btn-sm" data-custom-params="url:'@Url.ActionUrl()',callBack:'PostRefreshBack'">提交</button>
                <button type="button" class="btn btn-default ui-closeDialog btn-sm">关闭</button>
            </div>
        </div>
    </form>
</div>
<script type="text/javascript">
    var id = Request("id");
    if (IsInt(id)) {
        $("#_form").FormBind({ dataSourceFrom: "attr" })
    }

   function BeforeSubmit()
   {
       $(".trimSpace").each(function () {
           var $this = $(this);
           $this.val($this.val().Trim())
       });
    }
</script>
